package ferran.alcazar.one;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class dbHelper extends SQLiteOpenHelper {

	private static final String DB_NAME="db";
	public static final String TITLE="title";
	public static final String VALUE="value";
	
	public dbHelper (Context context, CursorFactory factory, int version){
		
		super(context, DB_NAME, null, version);
		
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		
		db.execSQL("CREATE TABLE Usuarios (nombre TEXT, edad TEXT, pais TEXT, partidas_jugadas INT, partidas_ganadas INT);");
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		android.util.Log.w("Constants", "Upgranding database. Destroying all data...");
		db.execSQL("DROP TABLE IF EXIST constants");
		onCreate(db);
		
	}

}
